# -*- python -*-
# Author: Charles Wang <charlesw123456@gmail.com>
# License: GPLv2

import os.path

Import('env', 'lib', 'cocoexe')

targets = ['Scanner.h', 'Scanner.c', 'Parser.h', 'Parser.c']

descTargets = map(lambda f: os.path.join('desc', f), targets)
env.Command(descTargets, [os.path.join('desc', 'Kconfig.atg')],
            '"%s" -g $SOURCES' % str(cocoexe[0]))
env.Depends(descTargets, cocoexe)

fileTargets = map(lambda f: os.path.join('file', f), targets)
env.Command(fileTargets, [os.path.join('file', 'Cfile.atg')],
            '"%s" -g $SOURCES' % str(cocoexe[0]))
env.Depends(fileTargets, cocoexe)

srcs = []
srcs.extend(map(lambda f: os.path.join('desc', f),
                ['KcData.c', 'Parser.c', 'Scanner.c']))
srcs.extend(map(lambda f: os.path.join('file', f),
                ['CfData.c', 'Parser.c', 'Scanner.c']))
objs = []
objs.extend(map(lambda f: env.Object(f), srcs))

env.Program('TestKconfig', ['main.c'] + objs + lib)

#gtkenv = env.Clone()
#gtkenv.ParseConfig('pkg-config --cflags --libs libglade-2.0')
#gtkenv.Program('gtkKconfig', [os.path.join('ui', 'gconf.c')] + objs + lib)
